package com.jiejie.listen;

import com.jiejie.service.OrderByService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


//@Component
public class OrderByListen extends KeyExpirationEventMessageListener {
    @Autowired
    private OrderByService orderByService;

    public OrderByListen(RedisMessageListenerContainer listenerContainer) {
        super(listenerContainer);
    }

    @Override
    public void onMessage(Message message,byte[] pattern){
        //1. 获得redis中过期的数据 key , value  （ commentlike_101  100 ）

        String keyStr = message.toString();  // redis key :  commentlike_101   value 100    , mysql : 101
        System.out.println("==========================================================");
        System.out.println(keyStr);
        if (keyStr.startsWith("OrderBy_Movie")){

        }
    }
}
